using System.Collections;
using WaterQualityReportSystem.models;
using WaterQualityReportSystem.utils;

namespace WaterQualityReportSystem
{
    public partial class InputDataManualDialog : Form
    {
        public ItemData ItemData { get; set; }

        public InputDataManualDialog()
        {
            InitializeComponent();

            initItemName();
            initUnit();
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btOK_Click(object sender, EventArgs e)
        {

            ItemData itemData = new ItemData();
            itemData.Name = cmbItemName.Text;
            itemData.Unit = cmbUnit.Text;
            itemData.Concentration = Tools.RoundToEven(Double.Parse(txtConcentration.Text),3).ToString("00000.000");
            itemData.TestDate = DateTime.Now;
            itemData.Transparency = "0.000";
            itemData.Absorbancy = "0.000";
            itemData.UserNo = "0";
            itemData.NO = "1";

            ItemData = itemData;

            this.DialogResult = DialogResult.OK;
        }

        private void initItemName() {
            cmbItemName.Items.Clear();
            for(int i = 0; i < Constants.TestNames.Length; i++) {
                //cmbItemName.Items.Add(Constants.TestNames[i]);
            }
            cmbItemName.Items.Add("细节总数");
        }

        private void initUnit()
        {
            cmbUnit.Items.Clear();
            //for (int i = 0; i < Constants.Units.Length; i++)
            //{
            //    cmbUnit.Items.Add(Constants.Units[i]);
            //}
            cmbUnit.Items.Add("CFU/100mL");
        }
    }

}
